home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / ste / double2.lzh / DOUBLE2.S < prev    next >
Text File  |  1991-07-02  |  6KB  |  205 lines

  1. start:        opt    o+
  2.  
  3.         bra    install
  4.  
  5. scroll_vbl:    movem.l    d0-d2/d7,-(sp)        ;save registers
  6.         move.w    screen_pos(pc),d0    ;top of screen
  7.         move.w    d0,d7
  8. save_mouse_y:    move.w    $0.l,d1            ;mouse y-pos
  9.         move.w    d1,d2
  10. margin1:    addi.w    #50,d0            ;x lines from top
  11.         sub.w    d0,d1            ;mouse-screen
  12.         blt.s    scroll_down
  13. margin2:    addi.w    #400-(2*50),d0        ;x lines from bottom            
  14.         sub.w    d0,d2            ;mouse-screen
  15.         bgt.s    scroll_up
  16.  
  17. end_vbl:    movem.l    (sp)+,d0-d2/d7        ;save registers
  18. vbl_return:    jmp    $0.l            ;return to real vbl
  19.  
  20. scroll_down:    add.w    d1,d7            ;scroll screen down
  21.         bgt.s    set_new_pos        ;past top of screen ?
  22.         clr.w    d7            ;yes, set to top
  23.         bra.s    set_new_pos
  24.         
  25. scroll_up:    add.w    d2,d7            ;scroll screen up
  26. lines1:        cmpi.w    #800-400,d7        ;past end of screen
  27.         blt.s    set_new_pos
  28. lines2:        move.w    #800-400,d7        ;yes, set to bottom
  29.         
  30. set_new_pos:    move.w    d7,screen_pos        ;save new position
  31. offset1:    mulu.w    #80,d7            ;byte position
  32.         add.l    logical(pc),d7        ;offset for screen
  33.  
  34. set_video_adr:    move.l    d7,screen_adr
  35.         move.b    screen_adr+1(pc),$FFFF8201.w    ;high
  36.         move.b    screen_adr+2(pc),$FFFF8203.w    ;middle
  37.         move.b    screen_adr+3(pc),$FFFF820D.w    ;low (only ste)
  38.         bra.s    end_vbl
  39.  
  40. interl_vbl:    movem.l    d0-d2/d7,-(sp)
  41.         move.l    logical(pc),d7
  42.         tst.b    screen_pos
  43.         beq.s    second_screen
  44.         clr.b    screen_pos
  45.         bra.s    set_video_adr    
  46. second_screen:    move.b    #1,screen_pos
  47. offset2:    addi.l    #80,d7
  48.         bra.s    set_video_adr
  49.  
  50.  
  51. new_gem:    cmpi.w    #$73,d0            ;vdi call ?
  52.         bne.s    return            ;no - return
  53.         
  54.         move.l    d1,a0            ;pointer to pb
  55.         move.l    (a0),a1            ;pointer to control
  56.         cmpi.w    #1,(a1)            ;control(0)=1 ?
  57.         bne.s    return            ;no - return
  58.  
  59.         move.l    12(a0),after_call+2    ;pointer to int_out
  60.         move.l    2(a7),save_return+2    ;real return adress
  61.         move.l    #after_call,2(a7)    ;fake return adress
  62.     
  63. return:        jmp    $0.l            ;to standard trap #2
  64.  
  65. after_call:    move.l    #$0,a0            ;pointer to int_out
  66. lines3:        move.w    #800-1,2(a0)        ;y-size in int_out(1)
  67. save_linea:    move.l    #$0,a0            ;linea pointer
  68. lines4:        move.w    #800,-4(a0)        ;vertical res
  69. chars1:        move.w    #25-1,-42(a0)        ;chars height -1
  70. lines5:        move.w    #800-1,-690(a0)        ;int_out(1)
  71.         move.w    return(pc),new_gem
  72.         move.l    return+2(pc),new_gem+2
  73. save_return:    jmp    $0.l            ;and to program
  74.  
  75. screen_pos:    dc.w    0            ;line at top of screen
  76. screen_adr:    ds.l    1            ;to calculate adress
  77. logical:    ds.l    1            ;logical screen adress
  78.  
  79. print_info:    pea    info(pc)        ;info text
  80.         move.w    #$09,-(sp)        ;print line
  81.         trap    #1            ;gemdos
  82.         addq.l    #6,sp
  83.         rts
  84.  
  85. install:    move.w    #-1,-(sp)        ;read status
  86.         move.w    #11,-(sp)        ;kbshift
  87.         trap    #13            ;bios
  88.         addq.l    #4,sp
  89.         
  90.         andi.b    #3,d0            ;SHIFT pressed ?
  91.         move.b    d0,d7            ;Save SHIFT status
  92.         bne.s    set_it_up        ;yep, install
  93.  
  94.         bsr.s    print_info        ;print info & help
  95.         clr.w    -(sp)            ;terminate
  96.         trap    #1            ;gemdos
  97.  
  98. set_it_up:    lea    stack(pc),sp        ;set up new stack
  99.  
  100.         move.l    #(stack-start)+$100,-(sp)    ;reserve only
  101.         move.l    #start-$100,-(sp)        ;needed memory
  102.         clr.w    -(sp)
  103.         move.w    #$4A,-(sp)        ;setblock
  104.         trap    #1            ;gemdos
  105.         lea    12(sp),sp
  106.  
  107.         clr.l    -(sp)            ;super mode
  108.         move.w    #$20,-(sp)        ;super
  109.         trap    #1            ;gemdos
  110.         addq.l    #6,sp
  111.  
  112.         move.l    #-1,-(sp)        ;get free bytes
  113.         move.w    #$48,-(sp)        ;malloc
  114.         trap    #1            ;gemdos
  115.         addq.l    #6,sp
  116.         
  117.         subi.l    #32000,d0        ;everything except
  118.         move.l    d0,-(sp)        ;32000 bytes extra
  119.         move.w    #$48,-(sp)        ;malloc
  120.         trap    #1            ;gemdos
  121.         addq.l    #6,sp
  122.         move.l    d0,d6            ;save start (for mfree)
  123.         
  124.         move.l    #32000,-(sp)        ;get last 32000 bytes
  125.         move.w    #$48,-(sp)        ;malloc
  126.         trap    #1            ;gemdos
  127.         addq.l    #6,sp
  128.         
  129.         move.l    d0,$436.w        ;new _memtop
  130.         move.l    d0,logical        ;new logical screen
  131.  
  132.         move.l    d6,-(sp)        ;area to free again
  133.         move.w    #$49,-(sp)        ;mfree
  134.         trap    #1
  135.         addq.l    #6,sp
  136.  
  137.         cmpi.b    #2,$44C.w        ;monochrome ?
  138.         beq.s    countinue        ;yes, do nothing
  139.         bsr    set_up_color        ;no, set up for color
  140.  
  141. countinue:    move.w    #-1,-(sp)        ;retain resolution
  142.         move.l    logical(pc),-(sp)
  143.         move.l    logical(pc),-(sp)
  144.         move.w    #5,-(sp)        ;setscreen
  145.         trap    #14            ;xbios
  146.         lea    12(sp),sp
  147.  
  148.         dc.w    $A000            ;get linea adress
  149.         move.l    a0,save_linea+2
  150. lines6:        move.w    #800,-4(a0)        ;vertical res
  151.         move.w    #800/16-1,-42(a0)    ;chars-1
  152.         suba.l    #600,a0            ;mouse y variable
  153.         move.l    a0,save_mouse_y+2    ;and save adress
  154.  
  155.         clr.b    info2            ;skip help info
  156.         bsr    print_info        ;info text on screen
  157.  
  158.         move.l    $88.w,return+2        ;save trap #2 adress
  159.         move.l    #new_gem,$88.w        ;set new trap #2 adress
  160.  
  161.         move.l    $70.w,vbl_return+2    ;save old vbl
  162.  
  163.         btst.l    #0,d7            ;Interlace mode
  164.         beq.s    offset3            ;yes, install it
  165.  
  166.         move.l    #scroll_vbl,$70.w    ;no, set new vbl
  167.         bra.s    exit            ;and exit
  168.  
  169. offset3:    move.b    #40,$FFFF820F.w        ;80 bytes offset
  170.         move.w    #50-1,chars1+2        ;50 chars heigth -1
  171.         move.l    #interl_vbl,$70.w    ;set new vbl
  172.  
  173. exit:        clr.w    -(sp)            
  174.         move.l    #(print_info-start)+$100,-(sp)
  175.         move.w    #$31,-(sp)
  176.         trap    #1
  177.  
  178. set_up_color:    move.w    #400,d0            ;all 400 places
  179.         move.w    d0,lines4+2
  180.         move.w    d0,lines6+2
  181.         subq.w    #1,d0            ;all 400-1 places
  182.         move.w    d0,lines3+2
  183.         move.w    d0,lines5+2
  184.         move.w    #400-200,d0        ;all 400-200 places
  185.         move.w    d0,lines1+2
  186.         move.w    d0,lines2+2
  187.         move.l    #160,d0            ;all 160 places
  188.         move.w    d0,offset1+2
  189.         move.l    d0,offset2+2
  190.         move.w    #80,offset3+2        ;all 80 places
  191.         move.w    #25,margin1+2        ;all 25 places
  192.         move.w    #200-(2*25),margin2+2    ;all 200-(2*25) places
  193.         rts
  194.  
  195. info:        dc.b    27,'E',10,'  STE  Double-Height Emulator  2.01'
  196.         dc.b    13,10,10, '  (C) Lars-Erik Østerud  02/07-1991'
  197.         dc.b    13,10,10
  198.         
  199. info2:        dc.b    10,'  RIGHT-SHIFT for Scrolling Display',13,10,10
  200.         dc.b    '  LEFT-SHIFT for Interlaced Display',13,10,10,0
  201.  
  202.         section    bss
  203.         
  204.         ds.l    10    ;place for program stack
  205. stack: